package com.bdsy.common.filter;

import org.sitemesh.builder.SiteMeshFilterBuilder;
import org.sitemesh.config.ConfigurableSiteMeshFilter;

import com.bdsy.common.tag.CssTagRuleBundle;
import com.bdsy.common.tag.ScriptTagRuleBundle;

/**
 * ClassName:SiteMeshFilter
 * Description: TODO 添加描述.
 * @author   Administrator
 * @version  
 * @since    JDK 1.8
 */
public class SiteMeshFilter extends ConfigurableSiteMeshFilter{

    
     /**
     * TODO 简单描述该方法的实现功能（可选）.
     * @see org.sitemesh.config.ConfigurableSiteMeshFilter#applyCustomConfiguration(org.sitemesh.builder.SiteMeshFilterBuilder)
     */
     
    @Override
    protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
        //Selector oldSelector = builder.getSelector();
        //使用我们自己定义的Selector，并且把原来的Selector传递到构造器里面去。
        //DecorateErrorPageSelector selector = new DecorateErrorPageSelector(oldSelector);
        //builder.setCustomSelector(selector);
    	
    	builder.addDecoratorPath("/sys/**", "/views/decorators/decorator.jsp")
        .addDecoratorPath("/a/**", "/views/decorators/decorator.jsp")
        .addExcludedPath("/assets/*").addExcludedPath("/login.html")
        .addExcludedPath("/api/*").addExcludedPath("/not_permission.jsp");
    	builder.addTagRuleBundles(new CssTagRuleBundle(), new ScriptTagRuleBundle());
    }

}

